Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactions: Fix waitFor behavior while debugging #18460

Merged
merged 19 commits into from
Jun 16, 2022

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Jun 10, 2022

Issue: #16872

What I did

Don't intercept calls inside callbacks, and bubble exceptions inside callbacks up to the parent rather than forwarding it to the next interceptable call. Show child interactions in log and display errors in the appropriate place. I got rid of the forwardedException concept entirely because it didn't (and can't) work with chained interactions (a().b()). Instead, any interaction that raises an exception will now appear in the log, even if it's not interceptable.

How to test

1 - Install @storybook/testing-library0.0.14--canary.23.ac6b056.0 in the oficcial-example project
2 - Run yarn start

  • Is this testable with Jest or Chromatic screenshots? Yes
  • Does this need a new example in the kitchen sink apps? No

If your answer is yes to any of these, please make sure to include it in your PR.

@ghengeveld ghengeveld added the bug label Jun 10, 2022
@nx-cloud
Copy link

nx-cloud bot commented Jun 10, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 73416f7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@shilman shilman changed the title Fix waitFor behavior while debugging Addon-interactions: Fix waitFor behavior while debugging Jun 11, 2022
@ghengeveld ghengeveld force-pushed the ghengeveld/ap-1950-fix-waitfor-behavior-while-debugging branch from 1fcbb72 to dcd77df Compare June 12, 2022 18:10
@ghengeveld ghengeveld force-pushed the ghengeveld/ap-1950-fix-waitfor-behavior-while-debugging branch from 3d3f90f to d7e5293 Compare June 12, 2022 18:12
@ghengeveld ghengeveld requested a review from yannbf June 14, 2022 12:14
@ghengeveld ghengeveld marked this pull request as ready for review June 14, 2022 12:14
@yannbf
Copy link
Member

yannbf commented Jun 15, 2022

Edit: Disregard this comment. Tested with wrong setup.

Awesome stuff @ghengeveld !

I noticed a possible issue in this story

Issue:

1 - waitFor is not visible, so it looks like the two last steps are child of userEvent
2 - when interacting, it fails

image

Steps to reproduce

1 - Click on Go to Start
2 - Click on Go forward 2x

@ghengeveld
Copy link
Member Author

@yannbf you need storybookjs/testing-library#23 as well.

@yannbf
Copy link
Member

yannbf commented Jun 16, 2022

@yannbf you need storybookjs/testing-library#23 as well.

Thanks! I updated the "How to test" section to reflect that.

@yannbf
Copy link
Member

yannbf commented Jun 16, 2022

I just tested many scenarios and they all were pretty good, awesome work @ghengeveld 🙌

@ghengeveld ghengeveld changed the title Addon-interactions: Fix waitFor behavior while debugging Interactions: Fix waitFor behavior while debugging Jun 16, 2022
@ghengeveld
Copy link
Member Author

@shilman This is ready to merge. I'll leave that up to your discretion.

@shilman shilman merged commit d4efb62 into next Jun 16, 2022
@shilman shilman deleted the ghengeveld/ap-1950-fix-waitfor-behavior-while-debugging branch June 16, 2022 16:08
@IanVS
Copy link
Member

IanVS commented Jun 16, 2022

Will this be picked into 6.5 as well, or does it rely on 7.0 changes?

@yannbf
Copy link
Member

yannbf commented Jun 16, 2022

Will this be picked into 6.5 as well, or does it rely on 7.0 changes?

This was just released in 7.0.0-alpha.3 and the corresponding fix of testing-library was released in 14.0.0-next.0 and the idea is to test it out enough to see if we bring it back to 6.5!

@IanVS
Copy link
Member

IanVS commented Jun 16, 2022

Awesome, I was able to hack it into my 6.5 vite project, and it seems like it's working great. I did find one potential bug, though:

await expect(newRoles).toEqual(expect.arrayContaining([expect.objectContaining({ name: 'New role' })]));

crashes the whole storybook app (white screen of death) with the following error in the console:

Encountered two children with the same key, `[object Object]`.

@ghengeveld
Copy link
Member Author

That looks like a key prop warming, but I doubt fixing it will resolve the white screen of death. Will investigate anyway.

@ghengeveld
Copy link
Member Author

ghengeveld commented Jun 17, 2022

Awesome, I was able to hack it into my 6.5 vite project, and it seems like it's working great. I did find one potential bug, though:
...

Fixed here: #18499

@ghengeveld
Copy link
Member Author

ghengeveld commented Aug 24, 2022

This should be backported to 6.5 along with #18499 in order to support storybookjs/testing-library#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants